//package com.zhuss.timer;
//
//import java.time.LocalDateTime;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import javax.annotation.PostConstruct;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.dao.DuplicateKeyException;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import com.zhuss.core.datasource1.dao.ext.BuildingDao;
//import com.zhuss.core.datasource1.dao.ext.RoomDao;
//import com.zhuss.core.datasource1.dao.ext.UnitDao;
//import com.zhuss.core.datasource1.dao.ext.VillageDao;
//import com.zhuss.core.datasource1.entity.Building;
//import com.zhuss.core.datasource1.entity.Village;
//import com.zhuss.core.datasource2.dao.ext.lBuildingDao;
//import com.zhuss.core.datasource2.dao.ext.lCommunityDao;
//
//
///**
// * building
// * @author Administrator
// *
// */
//
//@Component
//@Configuration  
//@EnableScheduling
//public class BuildingTask {
//	
//	@Autowired
//	private VillageDao villageDao;
//	
//	@Autowired
//	private BuildingDao buildingDao;
//	
//	@Autowired
//	private UnitDao unitDao;
//	
//	@Autowired
//	private RoomDao roomDao;
//	
//	@Autowired
//	private lCommunityDao lCommunityDao;
//	
//	@Autowired
//	private lBuildingDao lBuildingDao;
//	
//	// 中林的自增ID对应的小区
//	public static final Map<Long, Village> zlIncrMap = new HashMap<>(); 
//	
//	@PostConstruct
//	public void init() {
//		List<Village> vList = villageDao.listAll();
//		vList.forEach(item -> zlIncrMap.put(item.getZlIncr(), item));
//	}
//	
////	@Scheduled(cron = "1 1 1 * * ?")
//	@Scheduled(cron = "0/20 * * * * ?")
//	private void configureTasks() {
//		
//		Long maxIncr = buildingDao.selectMaxIncr();
//		List<Building> list = lBuildingDao.queryList(maxIncr);
//		
//		for (Building v : list) {
//			try {
//				// 设置 新表的 小区ID
//				Village village = zlIncrMap.get(v.getVillageId());
//				v.setVillageId(village.getVillageId());
//				v.setVillageName(village.getName());
//				buildingDao.create(v);
//			} catch (DuplicateKeyException e) {
//				e.printStackTrace();
//				continue;
//			}
//		}
//		
//		System.err.println("BuildingTask-------执行静态定时任务时间: " + LocalDateTime.now());
//	}
//	
//
//}
